The invention relates generally to computer data models, and in particular, to object-oriented models.
Structured Query Language (SQL) is a database computer language for data retrieval such as in a relational database. SQL allows dealing with data in a declarative manner and has gained popularity with database vendors. However, when handling data programmatically, i.e., from a high level programming language (such as C, C++ or Java), a mismatch appears since a software developer has to deal with two different environments speaking two different languages. This is because the relational environment uses declarative approaches (SQL), while the object-oriented environment uses procedural and object-based approaches. As such, the developer has to learn database languages such as SQL and what comes with it, such as stored procedures and data types, while also mastering programming languages such as Java, C, C++, C Sharp (C#) programming language, or even Visual Basic. Furthermore, the developer has to master the application programming interfaces (APIs) that bind said two environments together.
Object Relational Mapping (ORM) systems allow the developer to deal with objects in a simplified manner rather than dealing with raw data. ORM solutions offer the developer the ability to query relational data sources in an object-oriented manner, by providing their own query languages, such as EJB QL, JDOQL, HQL, and others.
However, using ORM, the developer still has to maintain two different languages (Java and the ORM-specific-QL provided by the ORM solutions) having different syntax, concepts and constructs. Moreover, such languages lack basic features developers have grown accustomed to such as debugging, testing, logging, etc. Further, such languages query only databases, and cannot support query of other data sources such as collections, or XML files.
SQLJ technology (a Java optimized query language) provides a programming interface that allows SQL statements to be expressed at a high level in a Java program. However, SQLJ is a new different language with different syntax written in external files. The same concept of SQLJ has also been applied to memory collections and arrays, in an attempt to provide a generalized Java based query language (Java Query Language (JQL)). However, this is for arrays and collections only, requiring composing different syntax in external files that need a pre-processing step as a front-end compiler.
Other modern programming languages such as C# and Visual Basic attempt to provide native query capabilities, and Microsoft has introduced LINQ (Language Integrated Query) providing query APIs to query different data sources. To achieve this, language syntax upgrades are made, such that “select”, “from”, “where”, “order by”, etc., become reserved key words in C#. IBM provides JLINQ which targets the same goals that LINQ targets. JLINQ offers the developer the ability to issue pure SQL statements from Java code, and get SQL validated at compile time by a special eclipse plug-in that detects the syntax mistakes and notifies the developer about them. However, using such approaches, the developer still has to maintain both Java code, and SQL code, to query a data source.